package br.com.intelsys.iflow.jbpm.task;

import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.jbpm.taskmgmt.def.TaskControllerHandler;
import org.jbpm.taskmgmt.exe.Assignable;
import org.jbpm.taskmgmt.exe.TaskInstance;

public class GenericTaskHandler implements AssignmentHandler, TaskControllerHandler, ActionHandler {
	private String reason;

	static {
		System.out.println("@@@@@@@@@@@ CARREGOU!!");
	}

	public String getReason() {
		System.out.println("@@@@@@@@@@ RETORNANDO reason: " +reason);
		return reason;
	}

	public void setReason(String reason) {
		System.out.println("@@@@@@@@@@ DEFININDO reason: " +reason);
		this.reason = reason;
	}
	
	@Override
	public void assign(Assignable arg0, ExecutionContext arg1) throws Exception {
		System.out.println("@@@@@@@@@@@@@@@@ assign");
	}

	@Override
	public void initializeTaskVariables(TaskInstance arg0, ContextInstance arg1, Token arg2) {
		System.out.println("@@@@@@@@@@@@@@@@ initializeTaskVariables");
	}

	@Override
	public void submitTaskVariables(TaskInstance arg0, ContextInstance arg1, Token arg2) {
		System.out.println("@@@@@@@@@@@@@@@@ submitTaskVariables");
	}

	@Override
	public void execute(ExecutionContext e) throws Exception {
		System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! actionnn"+e);		
	}
}
